﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using QualityEvaluatingTools.manager;
using QualityEvaluatingTools.model;

namespace QualityEvaluatingTools
{
    public partial class FormReadFrom : Form
    {
        private string excelPath = string.Empty;

        public FormReadFrom(string excelPath)
        {
            InitializeComponent();
            this.excelPath = excelPath;
        }

        private void FormReadFrom_Load(object sender, EventArgs e)
        {
            //多线程，控件可以穿插调用（很有用）
            Control.CheckForIllegalCrossThreadCalls = false;
            Thread thread = new Thread(StartCalculate);
            thread.Start();
        }

        /// <summary>
        /// 开始统计
        /// </summary>
        private void StartCalculate()
        {
            List<Evaluation> list = StuAnswerManager.GetStuEvaluationMsg(this.excelPath, this.pbJingDu);
            MainForm.evaluationList = list;
            MainForm.dataModelList = StuAnswerManager.GetDataModelList(list);
            this.Close();
        }
    }
}
